home *** CD-ROM | disk | FTP | other *** search
- /*
- GenericPatch.h
-
- Object representing a trap patch. Derived version.
-
- Two interfaces are possible: you can override Behavior and can access the patch's
- parameters from the parameters[] array provided in the PatchFrame structure; or you
- can override GetBehaviour to call a static member function directly and pull your
- object's instance from the PatchFrame structure, and make your calling conventions
- reflect the actual stack layout.
-
- by Patrick Beard & Mouse Herrel.
-
- ©1991, 92 by Berkeley Systems, Inc. All rights reserved.
- */
-
- #pragma once
-
- #ifdef applec
- #include "Patch.h"
- #define AncestorPatch TrapPatch
- #endif
-
- #ifdef THINK_C
- #if __option(a4_globals)
- #include "Patch.h"
- #define AncestorPatch TrapPatch
- #else
- #include "TestExtension.h"
- #include "ScalperPatch.h"
- #define AncestorPatch ScalperPatch
- #endif
- #endif
-
- class GenericPatch : public AncestorPatch {
- public:
- void InitGenericPatch(short trap, long resultOffset);
-
- protected:
- virtual void Behavior(void); // override this to do your stuff, or
- virtual PatchProcPtr GetDispatcher(void); // provide address of routine to call.
-
- // utility functions.
- virtual void AbortTrap(void); // call to abort the trap.
-
- private:
- static void Dispatch(PatchFrame frame);
-
- protected:
- PatchFrame* itsFrame; // current stack frame.
- long itsResultOffset; // offset to the result value on stack.
- };
-
- class GenericVectorPatch : public VectorPatch {
- public:
- void InitGenericVectorPatch(PatchVectorPtr vector, long resultOffset);
-
- protected:
- virtual void Behavior(void); // override this to do your stuff, or
- virtual PatchProcPtr GetDispatcher(void); // provide address of routine to call.
-
- // utility functions.
- virtual void AbortVector(void); // call to abort the vector.
-
- private:
- static void Dispatch(PatchFrame frame);
-
- protected:
- PatchFrame* itsFrame; // current stack frame.
- long itsResultOffset; // offset to the result value on stack.
- };
-